from alarms import *
# print(pio.renderers)
pio.renderers.default = "notebook"
path = "/home/waris/Github/tupras-analysis/new-alarm/stats-one-month.csv"
df = pd.read_csv("stats-one-month.csv", low_memory=False)
df["StartTime"] = df["StartTime"].apply(lambda d: parse(d))
df["EndTime"] = df["EndTime"].apply(lambda d: parse(d))
df["Time"] = df["Time"].apply(lambda d: datetime.strptime(d,"%H:%M").time())
# for col in df.columns:
# print(col, type(df[col][0]))
# print("===============")
# df.info()
df.head(20)
# df.describe()
The following graph shows all the alarms triggered in this dataset. The x-axis represents the activation time of an alarm, and the y-axis shows the duration (i.e., TimeDelta= StartTime - EndTime) of the corresponding activation. As we can see that most of the alarms deactivated within 20 seconds (it will be more clear in followings sections).
fig = px.scatter(df, x="StartTime", y="TimeDelta",render_mode="webgl")
fig.show()
This is one of the most important box plots in the whole analysis. It will help us to determine the threshold for TimeDelta. If the duration between activation and deactivation (i.e., TimeDelta = Deactivation - Activation) is less than the threshold then we will not transmit such alarm to the historian. From the following box plot, we can see that the first quartile (q1) is equal to 16 seconds which means if we set the threshold constant equals to 16 seconds we will directly reduce 25% of the communications between the DCS systems and Historian server. Similarly, if we set threshold constant to 29 seconds (i.e., q2 or median value) the 50 % of the storage & and communication will be reduced.
Questions:
Note: If hover the mouse over any graph it will show the values.
fig = px.box(df, y="TimeDelta")
fig.update_yaxes(range=[0, 100])
fig.show()
From the first histograms, we can see that "47TI931" triggered the most number of alarms. Additionally, all the alarms are related to “IOP” condition.
Questions
fig = px.histogram(df, x = "SourceName")
fig.update_layout(title="Number of times each SourceName triggered an alarm.")
fig.show()
fig = px.histogram(df, x = "SourceName", color="Condition", barmode='group')
fig.update_layout(title="Number of times a condition occured for a SourceName.")
fig.show()
fig = px.box(df, x= "SourceName", y="TimeDelta")
fig.update_yaxes(range=[0, 200])
fig.update_layout(title="Box Plot of TimeDelats (Deactivaion - Activation) for each SourceName")
fig.show()